//
//  StyleTableViewCell.m
//  YiChe
//
//  Created by 蒋杏飞 on 15/8/8.
//  Copyright (c) 2015年 蓝鸥科技. All rights reserved.
//

#import "StyleTableViewCell.h"
#import "CircleView.h"
// 里面有四个按钮，点击进入不同的视图控制器界面

@implementation StyleTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self createButtons];
    }
    return self;
}
// 创建四个按钮
- (void)createButtons
{
    CGFloat width = [UIScreen mainScreen].bounds.size.width / 4.0f;
    NSArray *arr = @[@"贷款买车", @"直销车型", @"底价买车", @"二手车"];
    for (int i = 0; i < 4; i++) {
        CircleView *circle = [[CircleView alloc] initWithFrame:CGRectMake(i * width, 0, width, 80)];
        circle.tag = i + 1;
        circle.target = self;
        circle.action = @selector(circleAction:);
        NSString *name = [NSString stringWithFormat:@"%d.png", i + 1];
        [circle setImage:name text:arr[i]];
        [self.contentView addSubview:circle];
        [circle release];
    }
}

#pragma mark - 
#pragma mark 点击事件

- (void)circleAction:(CircleView *)circle
{
    [self.delegate clickStyleWith:circle.tag];
}


@end
